home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
program
/
ctlib100.zip
/
INSTALL.LZH
/
CTCOLLEC.INT
< prev
next >
Wrap
Text File
|
1996-10-12
|
9KB
|
232 lines
{**************************************************************************}
{* BitSoft Development, L.L.C. *}
{* Copyright (C) 1995, 1996 BitSoft Developmet, L.L.C. *}
{* All rights reserved. *}
{* Collection objects unit *}
{* Version 1.3.5 *}
{**************************************************************************}
unit ctCollec;
{$X+}
interface
uses Objects,
Containr, ctTypes;
const
MaxHugeCollectionSize = MaxCollectionSize * MaxCollectionSize;
type
PHugeItemList = ^THugeItemList;
THugeItemList = array [0..Pred(MaxCollectionSize)] of PItemList;
type
PHugeCollection = ^THugeCollection;
THugeCollection = object(TSequence)
Data : PHugeItemList;
Limit : LongInt;
Delta : Word;
constructor Init (ALimit: LongInt; ADelta: Word);
constructor Load (var S : TStream);
destructor Done; virtual;
function At (Index : LongInt): Pointer; virtual;
function AtDelete (Index: LongInt): Boolean; virtual;
function AtInsert(Index: LongInt; Item: Pointer): Boolean; virtual;
function AtPut(Index : LongInt; Item : Pointer) : Boolean; virtual;
function DeleteAll: Boolean; virtual;
function IndexOf (Item: Pointer) : LongInt; virtual;
function Pack: Boolean; virtual;
function SetLimit(ALimit: LongInt) : Boolean; virtual;
procedure Store(var S : TStream); virtual;
end; { THugeCollection }
type
PHugeSortedCollection = ^THugeSortedCollection;
THugeSortedCollection = object(THugeCollection)
Duplicates : Boolean;
CaseSensitive : Boolean;
constructor Init(ALimit, ADelta : LongInt);
constructor Load(var S : TStream);
function Compare(Key1, Key2 : Pointer): Integer; virtual;
function IndexOf (Item : Pointer) : LongInt; virtual;
function Insert(Item : Pointer) : Boolean; virtual;
function KeyOf(Item : Pointer) : Pointer; virtual;
function Search(Key : Pointer; var Index : LongInt) : Boolean; virtual;
procedure Store(var S : TStream); virtual;
end; { THugeSortedCollection }
type
PHugeStringCollection = ^THugeStringCollection;
THugeStringCollection = object(THugeSortedCollection)
procedure FreeItem(Item : Pointer); virtual;
function GetItem(var S: TStream): Pointer; virtual;
function KeyOf(Item : Pointer) : Pointer; virtual;
procedure PutItem(var S: TStream; Item : Pointer); virtual;
end; { THugeStringCollection }
type
PHugeUnSortedStrCollection = ^THugeUnSortedStrCollection;
THugeUnSortedStrCollection = object(THugeCollection)
procedure FreeItem(Item : Pointer); virtual;
function GetItem(var S: TStream): Pointer; virtual;
procedure PutItem(var S: TStream; Item : Pointer); virtual;
end; { THugeUnSortedStrCollection }
type
PStreamCollection = ^TStreamCollection;
TStreamCollection = object(TSequence)
Stream : PStream;
Delta : Word;
Limit : LongInt;
constructor Init (ALimit: LongInt; ADelta: Word);
constructor Load (var S : TStream);
destructor Done; virtual;
function At (Index : LongInt): Pointer; virtual;
function AtDelete (Index: LongInt): Boolean; virtual;
function AtInsert(Index: LongInt; Item: Pointer): Boolean; virtual;
function AtPut(Index : LongInt; Item : Pointer) : Boolean; virtual;
function DeleteAll: Boolean; virtual;
function IndexOf (Item: Pointer) : LongInt; virtual;
function InitStream(Size : LongInt) : PStream; virtual;
function Pack: Boolean; virtual;
procedure Reset; virtual;
function SetLimit(ALimit: LongInt) : Boolean; virtual;
procedure Store(var S : TStream); virtual;
end; { TStreamCollection }
type
PEmsCollection = ^TEmsCollection;
TEmsCollection = object(TStreamCollection)
function InitStream(Size : LongInt): PStream; virtual;
end; { TEmsCollection }
type
PStreamSortedCollection = ^TStreamSortedCollection;
TStreamSortedCollection = object(TStreamCollection)
Duplicates : Boolean;
CaseSensitive : Boolean;
constructor Init(ALimit, ADelta : LongInt);
constructor Load(var S : TStream);
function Compare(Key1, Key2 : Pointer): Integer; virtual;
function IndexOf (Item : Pointer) : LongInt; virtual;
function Insert(Item : Pointer) : Boolean; virtual;
function KeyOf(Item : Pointer) : Pointer; virtual;
function Search(Key : Pointer; var Index : LongInt) : Boolean; virtual;
procedure Store(var S : TStream); virtual;
end; { TStreamSortedCollection }
type
PEmsSortedCollection = ^TEmsSortedCollection;
TEmsSortedCollection = object(TStreamSortedCollection)
function InitStream(Size : LongInt): PStream; virtual;
end; { TEmsSortedCollection }
type
PStreamStringCollection = ^TStreamStringCollection;
TStreamStringCollection = object(TStreamSortedCollection)
procedure FreeItem(Item : Pointer); virtual;
function GetItem(var S: TStream): Pointer; virtual;
function KeyOf(Item : Pointer) : Pointer; virtual;
procedure PutItem(var S: TStream; Item : Pointer); virtual;
end; { TStreamStringCollection }
type
PEmsStringCollection = ^TEmsStringCollection;
TEmsStringCollection = object(TStreamStringCollection)
function InitStream(Size : LongInt): PStream; virtual;
end; { TEmsStringCollection }
type
PStreamUnSortedStrCollection = ^TStreamUnSortedStrCollection;
TStreamUnSortedStrCollection = object(TStreamCollection)
procedure FreeItem(Item : Pointer); virtual;
function GetItem(var S: TStream): Pointer; virtual;
procedure PutItem(var S: TStream; Item : Pointer); virtual;
end; { TStreamUnSortedStrCollection }
type
PEmsUnSortedStrCollection = ^TEmsUnSortedStrCollection;
TEmsUnSortedStrCollection = object(TStreamUnSortedStrCollection)
function InitStream(Size : LongInt): PStream; virtual;
end; { TEmsUnSortedStrCollection }
procedure RegisterCollections;
const
RStreamCollection : TStreamRec = (
ObjType: idStreamCollection;
VmtLink: Ofs(TypeOf(TStreamCollection)^);
Load: @TStreamCollection.Load;
Store: @TStreamCollection.Store);
REmsCollection : TStreamRec = (
ObjType: idEmsCollection;
VmtLink: Ofs(TypeOf(TEmsCollection)^);
Load: @TEmsCollection.Load;
Store: @TEmsCollection.Store);
RStreamSortedCollection : TStreamRec = (
ObjType: idStreamSortedCollection;
VmtLink: Ofs(TypeOf(TStreamSortedCollection)^);
Load: @TStreamSortedCollection.Load;
Store: @TStreamSortedCollection.Store);
REmsSortedCollection : TStreamRec = (
ObjType: idEmsSortedCollection;
VmtLink: Ofs(TypeOf(TEmsSortedCollection)^);
Load: @TEmsSortedCollection.Load;
Store: @TEmsSortedCollection.Store);
RStreamStringCollection : TStreamRec = (
ObjType: idStreamStringCollection;
VmtLink: Ofs(TypeOf(TStreamStringCollection)^);
Load: @TStreamStringCollection.Load;
Store: @TStreamStringCollection.Store);
REmsStringCollection : TStreamRec = (
ObjType: idEmsStringCollection;
VmtLink: Ofs(TypeOf(TEmsStringCollection)^);
Load: @TEmsStringCollection.Load;
Store: @TEmsStringCollection.Store);
RStreamUnSortedStrCollection : TStreamRec = (
ObjType: idStreamUnSortedStrCollection;
VmtLink: Ofs(TypeOf(TStreamUnSortedStrCollection)^);
Load: @TStreamUnSortedStrCollection.Load;
Store: @TStreamUnSortedStrCollection.Store);
REmsUnSortedStrCollection : TStreamRec = (
ObjType: idEmsUnSortedStrCollection;
VmtLink: Ofs(TypeOf(TEmsUnSortedStrCollection)^);
Load: @TEmsUnSortedStrCollection.Load;
Store: @TEmsUnSortedStrCollection.Store);
RHugeCollection : TStreamRec = (
ObjType: idHugeCollection;
VmtLink: Ofs(TypeOf(THugeCollection)^);
Load: @THugeCollection.Load;
Store: @THugeCollection.Store);
RHugeSortedCollection : TStreamRec = (
ObjType: idHugeSortedCollection;
VmtLink: Ofs(TypeOf(THugeSortedCollection)^);
Load: @THugeSortedCollection.Load;
Store: @THugeSortedCollection.Store);
RHugeStringCollection : TStreamRec = (
ObjType: idHugeStringCollection;
VmtLink: Ofs(TypeOf(THugeStringCollection)^);
Load: @THugeStringCollection.Load;
Store: @THugeStringCollection.Store);
RHugeUnSortedStrCollection : TStreamRec = (
ObjType: idHugeUnSortedStrCollection;
VmtLink: Ofs(TypeOf(THugeUnSortedStrCollection)^);
Load: @THugeUnSortedStrCollection.Load;
Store: @THugeUnSortedStrCollection.Store);
implementation
end.